********************************************************************************************************************
********************************************************************************************************************
*NOTE: Our Stata code replicates analyses presented in the paper and supplemental appendix.*

*The code below requires that the following programs are installed: rangestat, ebalance, balancetable, estout*

*Figure 2 in the main paper draws on data on COVID-19 cases and deaths from the New York Times GitHub page. Please see the Readme document included with this replication file for instructions on how to download this data.*

*Set your working directory so that you can input data, and so that tables are output to an appropriate folder*
********************************************************************************************************************
********************************************************************************************************************

********************************************************************************************************************
********************************************************************************************************************
********************************************************************************************************************
*Replication for Results in Main Text* 
********************************************************************************************************************
********************************************************************************************************************
********************************************************************************************************************

********************************************************************************************************************
********************************************************************************************************************
*Figure 1. Survey Responses Over Period of Study* 
********************************************************************************************************************
********************************************************************************************************************
use Main.dta, clear
cumul StartDay, gen(cStartDay)

twoway (histogram StartDay, frequency yaxis(1) acolor(gs12%50) ytitle(Number of Completions)) ///
	(line cStartDay StartDay, yaxis(2) lcolor(black%70) lwidth(thick) ytitle(Cumulative Probability, axis(2))) ///
	,  yscale(range(0 1) axis(2) )  ///
	 xlab(21976 "2Mar" 21987 "13Mar" 21998 "24Mar" 22014 "9Apr" 22020 "15Apr" 22034 "29Apr" 22043 "8May" 22048 " " 22050 "13/15May", labsize(small)) scheme(s1color) legend(off) ///
	 tline(21987 21989 21994 21998 22016 22017 22043, lp(dash) lcolor(black%90)) ///
	xtitle(Survey Completion Date (2020)) 
graph export "Fig1.pdf", as(pdf) replace

********************************************************************************************************************
********************************************************************************************************************
*Figure 2. COVID-19 Cases, Deaths Over Period of Study (U.S. and New York)* 
********************************************************************************************************************
********************************************************************************************************************

*Note: Readme file contains instructions on how to download data needed to replicate Figure 2.*

*First, clean state-level data and save a new dataset containing data for New York State only.
clear all
import delimited "NYOnly.csv"
keep if state=="New York"
drop fips
ren date Date
ren state State
ren cases Cases_NY
ren deaths Deaths_NY

gen StartDay = date(Date, "YMD")
save "NY_Only.dta", replace

*Then, clean the data file for the entire US*
clear all
import delimited "US.csv"
ren date Date
ren cases Cases_USA
ren deaths Deaths_USA

gen StartDay = date(Date, "DMY")

*Merge the US data with the New York data*
merge 1:1 StartDay using "NY_Only.dta"
drop _merge

*Declare time series daily data*
tsset StartDay, daily

*To generate a count of new cases and deaths per day, subtract the previous day's total from each day*
generate newcases_USA = D.Cases_USA
generate newcases_NY = D.Cases_NY

*Note: Generate 7-day moving averages, which are the average of a day and the previous six days of data-*
rangestat (mean) avgUSA_Cases = newcases_USA (count) count_USA = newcases_USA, interval(StartDay -6 0)
rangestat (mean) avgNY_Cases = newcases_NY (count) count_NY = newcases_NY, interval(StartDay -6 0)

*First, generate figure for number of cases.*
preserve
*Only retain observations over the timeframe of the survey: March 2 to May 15*
keep if StartDay>=21976 & StartDay<=22050

twoway (tsline newcases_USA, lcolor(black%70) lwidth(thin) lp(dash) ytitle(Number of New Cases))  /// 
       (tsline newcases_NY, lcolor(gs12%50) lwidth(thin) lp(dash) ytitle(Number of New Cases)) ///
	   (tsline avgUSA_Cases, lcolor(black%70) lwidth(thick) ytitle(Number of New Cases)) ///
       (tsline avgNY_Cases, lcolor(gs12%50) lwidth(thick) ytitle(Number of New Cases) ///
	   tline(21987 21989 21994 21998 22016 22017 22043, lp(dash) lcolor(black%90)) ///
	   ylab(20000 "20000" 40000 "40000") ///
	   xlab(21976 "2Mar" 21987 "13Mar" 21998 "24Mar" 22014 "9Apr" 22020 "15Apr" 22034 "29Apr" 22043 "8May" 22048 " " 22050 "13/15May", labsize(vsmall)) scheme(s1color) legend(off) ///
	   xtitle(Date) name(Cases, replace) title("Cases"))   
restore

*Second, generate figure for number of deaths.*
generate newdeaths_USA = D.Deaths_USA
generate newdeaths_NY = D.Deaths_NY

*Note: Generate 7-day moving averages, which are the average of a day and the previous six days of data-*
rangestat (mean) avgUSA_Deaths = newdeaths_USA (count) count_USA_D = newdeaths_USA, interval(StartDay -6 0)
rangestat (mean) avgNY_Deaths = newdeaths_NY (count) count_NY_D = newdeaths_NY, interval(StartDay -6 0)

preserve
*Only retain observations over the timeframe of the survey: March 2 to May 15*
keep if StartDay>=21976 & StartDay<=22050

twoway (tsline newdeaths_USA, lcolor(black%70) lwidth(thin) lp(dash) ytitle(Number of New Deaths))  /// 
       (tsline newdeaths_NY, lcolor(gs12%50) lwidth(thin) lp(dash) ytitle(Number of New Deaths)) ///
	   (tsline avgUSA_Deaths, lcolor(black%70) lwidth(thick) ytitle(Number of New Deaths)) ///
       (tsline avgNY_Deaths, lcolor(gs12%50) lwidth(thick) ytitle(Number of New Deaths) ///
	   tline(21987 21989 21994 21998 22016 22017 22043, lp(dash) lcolor(black%90)) ///
	   xlab(21976 "2Mar" 21987 "13Mar" 21998 "24Mar" 22014 "9Apr" 22020 "15Apr" 22034 "29Apr" 22043 "8May" 22048 " " 22050 "13/15May", labsize(vsmall)) scheme(s1color) legend(off) ///
	   xtitle(Date) title("Deaths") name(Deaths, replace))   
restore

*Then, combine into a single graph.*
graph combine Cases Deaths, rows(2) cols(1) scheme(s1color)
graph export "Fig2.pdf", as(pdf) replace

********************************************************************************************************************
********************************************************************************************************************
*Table 1. Balance on Demographics: Full Sample* 
********************************************************************************************************************
********************************************************************************************************************
use Main.dta, clear

*To see pre- and post-cutoff sample sizes, by cutoff:
foreach var in Cutoff1 Cutoff2 Cutoff3 Cutoff5 Cutoff7 {
tab `var'
}

*Generate balance table, including results separately for each of the specified cutoffs. Cutoff numbers correspond to the pre-analysis plan specified cutoffs; however, as noted in the text, because there were no surveys completed between March 20 and March 24, or between April 11 and 12, results would be identical for these cutoffs and we accordingly consolidate cutoffs in our analysis and numbering in the main text.*

preserve

*Multiply percentages by 100.*
foreach var in Gender_Bin_Wom USPerm Hispanic Ethnicity5 BachHigher fifthyr {
ren `var' `var'_n
gen `var'=100*(`var'_n)	
}
label var Gender_Bin_Wom "Women (\%)"
label var USPerm "U.S. Citizen/Perm Res (\%)"
label var Hispanic "Hispanic (\%)" 
label var Age "Age (average)" 
label var BachHigher "Parent: Bach Deg/Higher (\%)" 
label var fifthyr "5th Year PhD (vs. 2nd, (\%))" 
label var Ethnicity5 "White (\%)"

balancetable Cutoff1 Gender_Bin_Wom USPerm Hispanic Ethnicity5 Age BachHigher fifthyr using "Table1.tex", observationscolumn pval varlabels  ctitles("Before Cutoff" "After Cutoff" "Difference (Before-After)" "N") format(%9.2f) nofoot leftctitle(" ") oneline replace

balancetable Cutoff2 Gender_Bin_Wom USPerm Hispanic Ethnicity5 Age BachHigher fifthyr using "Table1.tex", nonumbers observationscolumn pval varlabels format(%9.2f) nohead nofoot oneline  append

balancetable Cutoff3 Gender_Bin_Wom USPerm Hispanic Ethnicity5 Age BachHigher fifthyr using "Table1.tex", nonumbers observationscolumn pval varlabels format(%9.2f) nohead nofoot oneline append

balancetable Cutoff5 Gender_Bin_Wom USPerm Hispanic Ethnicity5 Age BachHigher fifthyr using "Table1.tex", nonumbers observationscolumn pval varlabels format(%9.2f) nohead nofoot oneline append

balancetable Cutoff7 Gender_Bin_Wom USPerm Hispanic Ethnicity5 Age BachHigher fifthyr using "Table1.tex", nonumbers observationscolumn pval varlabels format(%9.2f) nohead noobservations oneline append
restore

********************************************************************************************************************
********************************************************************************************************************
*Table 2. Overall Effects by Cutoff Date* 
********************************************************************************************************************
********************************************************************************************************************

*Define control variables*
global Controls Gender_Bin_Wom USPerm Age BachHigher fifthyr

*The following outputs, for the April 11 cutoff (first four columns) and the May 8 cutoff (second four columns), a separate table for each outcome of interest with results for each of the four different regression specifications.*
foreach var in index_AcCareer_Index index_NonAcCareer_Index index_AcSkills_Index index_NonAcSkills_Index index_AcJobCharac_Index index_NonAcJobCharac_Index Stress_Mgmt Career_Direction Dept_Support Dept_Prep Claim_Fee {
est clear
ren Cutoff5 Cutoff
qui eststo: reg `var' Cutoff if samp4==1, cl(Day)
	estadd scalar n = e(N)
qui eststo: reg `var' Cutoff c.DaysSinceStart c.avgUSA_Cases if samp4==1, cl(Day)
	estadd scalar n = e(N)
qui eststo: reg `var' Cutoff c.DaysSinceStart c.avgUSA_Cases $Controls  if samp4==1, cl(Day)
	estadd scalar n = e(N)

svyset Day [pweight=Cutoff5_Mean2]
qui eststo: svy: reg `var' Cutoff c.DaysSinceStart c.avgUSA_Cases
	estadd scalar n = e(N)

ren Cutoff Cutoff5
ren Cutoff7 Cutoff
	
qui eststo: reg `var' Cutoff if samp4==1, cl(Day)
	estadd scalar n = e(N)
qui eststo: reg `var' Cutoff c.DaysSinceStart c.avgUSA_Cases if samp4==1, cl(Day)
	estadd scalar n = e(N)
qui eststo: reg `var' Cutoff c.DaysSinceStart c.avgUSA_Cases $Controls  if samp4==1, cl(Day)
	estadd scalar n = e(N)

svyset Day [pweight=Cutoff7_Mean2]
qui eststo: svy: reg `var' Cutoff c.DaysSinceStart c.avgUSA_Cases
	estadd scalar n = e(N)

ren Cutoff Cutoff7
	
estout using "Table2_`var'.tex", replace ///
cells(b(fmt(%9.2f) star) se(par fmt(%9.2f))) style(tex) ///
stats(n, labels("\# Respondents") ///
fmt(%9.0f %9.0f %9.0f)) ///
starlevels(* .10 ** .05 *** .01) ///
keep(Cutoff) /// 
order(Cutoff) /// 
varlabels (Cutoff "Cutoff") ///
mlabels(none) collabels(none)		

}

********************************************************************************************************************
********************************************************************************************************************
*Table 3. Interaction Effects by Cutoff Date* 
********************************************************************************************************************
********************************************************************************************************************

*The following outputs, for the April 11 cutoff (first four columns) and the May 8 cutoff (second four columns), a separate table for each outcome of interest with results for each of the four different regression specifications.*
foreach var in index_AcCareer_Index index_NonAcCareer_Index index_AcSkills_Index index_NonAcSkills_Index index_AcJobCharac_Index index_NonAcJobCharac_Index Stress_Mgmt Career_Direction Dept_Support Dept_Prep Claim_Fee {
est clear
ren Cutoff5XXfifth Cutoff
qui eststo: reg `var' i.Cutoff5 i.fifthyr Cutoff if samp4==1, cl(Day)
	estadd scalar n = e(N)
qui eststo: reg `var' i.Cutoff5 i.fifthyr Cutoff c.DaysSinceStart c.avgUSA_Cases if samp4==1, cl(Day)
	estadd scalar n = e(N)
qui eststo: reg `var' i.Cutoff5 i.fifthyr Cutoff c.DaysSinceStart c.avgUSA_Cases $Controls  if samp4==1, cl(Day)
	estadd scalar n = e(N)

svyset Day [pweight=Cutoff5_Mean2]
qui eststo: svy: reg `var' i.Cutoff5 i.fifthyr Cutoff c.DaysSinceStart c.avgUSA_Cases
	estadd scalar n = e(N)

ren Cutoff Cutoff5XXfifth
ren Cutoff7XXfifth Cutoff
	
qui eststo: reg `var' i.Cutoff7 i.fifthyr Cutoff if samp4==1, cl(Day)
	estadd scalar n = e(N)
qui eststo: reg `var' i.Cutoff7 i.fifthyr Cutoff c.DaysSinceStart c.avgUSA_Cases if samp4==1, cl(Day)
	estadd scalar n = e(N)
qui eststo: reg `var' i.Cutoff7 i.fifthyr Cutoff c.DaysSinceStart c.avgUSA_Cases $Controls  if samp4==1, cl(Day)
	estadd scalar n = e(N)

svyset Day [pweight=Cutoff7_Mean2]
qui eststo: svy: reg `var' i.Cutoff7 i.fifthyr Cutoff c.DaysSinceStart c.avgUSA_Cases
	estadd scalar n = e(N)

ren Cutoff Cutoff7XXfifth
	
estout using "Table3_`var'.tex", replace ///
cells(b(fmt(%9.2f) star) se(par fmt(%9.2f))) style(tex) ///
stats(n, labels("\# Respondents") ///
fmt(%9.0f %9.0f %9.0f)) ///
starlevels(* .10 ** .05 *** .01) ///
keep(Cutoff) /// 
order(Cutoff) /// 
varlabels (Cutoff "Cutoff X Fifthyr") ///
mlabels(none) collabels(none)		

}

********************************************************************************************************************
********************************************************************************************************************
*Figure 3. Treatment Effects by PhD Year: Index Components* 
********************************************************************************************************************
********************************************************************************************************************

*First, we generate the top panel of figure 3 (for the April 11 cutoff). Then, we generate the bottom panel (for the May 8 cutoff).*
capture drop temp

*2nd yrs
est clear
local i=0
foreach x in index_NonAcCareer_Index ///
	AppliedResearch Development ManagingSupervising ManagingProjects ProfServices PreSchoolSchool USFedGov USStateGov ForeignGov NonProfit ForProfit SelfEmployed ///
	index_NonAcJobCharac_Index Salary Benefits JobSecurity JobLocation ContribSociety WorklifeBalance ///
	{
	local ++i
	di `i'
	gen t`i' = Cutoff5
	  *2nd years
	qui  regress `x' t`i' if samp4==1 & fifthyr==0, cl(Day)
      estimates store est`i'
	  drop t`i' 
	  local ++i
	  di `i'
	  gen t`i' = Cutoff5
	  *5th years
	 qui regress `x' t`i' if samp4==1 & fifthyr==1, cl(Day)
      estimates store est`i'
	  drop t`i' 
  }	
  
capture drop temp
gen temp = " " in 1
replace temp =  "{bf: Non-Academic Career Index}" in 2
replace temp =  " " in 3
replace temp =  "Applied Research" in 4
replace temp = " " in 5
replace temp = "Development" in 6
replace temp = " " in 7
replace temp = "Managing/Supervising" in 8
replace temp = " " in 9
replace temp = "Managing Projects" in 10
replace temp = " " in 11
replace temp = "Professional Services" in 12
replace temp = " " in 13
replace temp = "Secondary School or Lower Educ" in 14
replace temp = " '" in 15
replace temp = "U.S. Federal Gov't'" in 16
replace temp = " " in 17
replace temp = "U.S. State/Local Gov't'" in 18
replace temp = " " in 19
replace temp = "Foreign Gov't'" in 20
replace temp = " " in 21
replace temp = "Non-profit" in 22
replace temp = " " in 23
replace temp = "For-profit" in 24
replace temp = " " in 25
replace temp = "Self-employed" in 26

replace temp = " " in 27
replace temp = "{bf: Non-Academic Job Char Index}" in 28
replace temp = " " in 29
replace temp = "Salary" in 30
replace temp = " " in 31
replace temp = "Benefits" in 32
replace temp = " " in 33
replace temp = "Job Security" in 34
replace temp = " " in 35
replace temp = "Job Location" in 36
replace temp = " " in 37
replace temp = "Contribution to Society" in 38
replace temp = " " in 39
replace temp = "Work-life Balance" in 40

coefplot est1 est2 est3 est4 est5 est6 est7 ///
	est8 est9 est10 est11 est12 est13 ///
	est14 est15 est16 ///
	est17 est18 est19 est20 ///
	est21 est22 est23 est24 est25 est26 est27 est28 est29 est30 est31 est32 ///
	est33 est34 est35 est36 est37 est38 est39 est40, level(95 90) ///
keep(t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t13 t14 t15 t16 t17 t18 t19 t20 t21 t22 t23 t24 t25 ///
t26 t27 t28 t29 t30 t31 t32 t33 t34 t35 t36 t37 t38 t39 t40) yline(0, lcolor(gs14) lwidth(thin)) ///
scheme(s1color) aspectratio(0.5) ylab(-.6 "-.6" -.4 "-.4" -.2 ".2" 0 "0" .2 ".2" .4 ".4" .6 ".6") ///
 legend(off) groups(t1 t2 = " " t3 t4 = " " t5 t6 = " " t7 t8 = " " ///
 t9 t10 = " " t11 t12 = " " t13 t14 = " " ///
 t15 t16 = " " t17 t18 = " " t19 t20 = " " t21 t22 = " " t23 t24 = " " t25 t26= " " t27 t28 = " " t29 t30 = " " t31 t32 = " " t33 t34 = " " t35 t36 = " " t37 t38 = " " t39 t40= " ", labsize(tiny)) ///
 vertical  plotregion(lcolor(white)) xscale(range(-0.01 0.05) lcolor(white))  yscale(lcolor(white)) ///
 coeflabel(t1=" " t2=" " t3=" " t4=" " t5=" " t6=" " t7=" " t8=" " t9=" " t10=" " t11=" " t12=" " ///
 t13=" " t14=" " t15=" " t16=" " t17=" " t18=" " t19=" " t20=" " t21=" " t22=" " t23=" " t24=" " t25=" " ///
 t26=" " t27=" " t28=" " t29=" " t30=" " t31=" " t32= " " t33= " " t34= " " t35=" " t36= " " t37= " " t38= " " t39= " " t40= " ", notick) legend(off) ///
 p1(mcolor(gray%100) msymbol(T) ciopts(lcolor(gray%100 gray%100))) ///
 p2(mcolor(black%80) ciopts(lcolor(black%80 black%80))) ///
 p3(mcolor(gray%40) msymbol(T) ciopts(lcolor(gray%40 gray%40))) ///
 p4(mcolor(black%40) ciopts(lcolor(black%40 black%40))) ///
 p5(mcolor(gray%40) msymbol(T) ciopts(lcolor(gray%40 gray%40))) ///
 p6(mcolor(black%40) ciopts(lcolor(black%40 black%40))) ///
 p7(mcolor(gray%40) msymbol(T) ciopts(lcolor(gray%40 gray%40))) ///
 p8(mcolor(black%40) ciopts(lcolor(black%40 black%40))) ///
 p9(mcolor(gray%40) msymbol(T) ciopts(lcolor(gray%40 gray%40))) ///
 p10(mcolor(black%40) ciopts(lcolor(black%40 black%40))) ///
 p11(mcolor(gray%40) msymbol(T) ciopts(lcolor(gray%40 gray%40))) ///
 p12(mcolor(black%40) ciopts(lcolor(black%40 black%40))) ///
 p13(mcolor(gray%40) msymbol(T) ciopts(lcolor(gray%40 gray%40))) ///
 p14(mcolor(black%40) ciopts(lcolor(black%40 black%40))) ///
 p15(mcolor(gray%40) msymbol(T) ciopts(lcolor(gray%40 gray%40))) ///
 p16(mcolor(black%40) ciopts(lcolor(black%40 black%40))) ///
 p17(mcolor(gray%40) msymbol(T) ciopts(lcolor(gray%40 gray%40))) ///
 p18(mcolor(black%40) ciopts(lcolor(black%40 black%40))) ///
 p19(mcolor(gray%40) msymbol(T) ciopts(lcolor(gray%40 gray%40))) ///
 p20(mcolor(black%40) ciopts(lcolor(black%40 black%40))) ///
 p21(mcolor(gray%40) msymbol(T) ciopts(lcolor(gray%40 gray%40))) ///
 p22(mcolor(black%40) ciopts(lcolor(black%40 black%40))) ///
 p23(mcolor(gray%40) msymbol(T) ciopts(lcolor(gray%40 gray%40))) ///
 p24(mcolor(black%40) ciopts(lcolor(black%40 black%40))) ///
 p25(mcolor(gray%40) msymbol(T) ciopts(lcolor(gray%40 gray%40))) ///
 p26(mcolor(black%40) ciopts(lcolor(black%40 black%40))) ///
 p27(mcolor(gray%100) msymbol(T) ciopts(lcolor(gray%100 gray%100))) ///
 p28(mcolor(black%80) ciopts(lcolor(black%80 black%80)))  ///
 p29(mcolor(gray%40) msymbol(T) ciopts(lcolor(gray%40 gray%40))) ///
 p30(mcolor(black%40) ciopts(lcolor(black%40 black%40))) ///
 p31(mcolor(gray%40) msymbol(T) ciopts(lcolor(gray%40 gray%40))) ///
 p32(mcolor(black%40) ciopts(lcolor(black%40 black%40))) ///
 p33(mcolor(gray%40) msymbol(T) ciopts(lcolor(gray%40 gray%40))) ///
 p34(mcolor(black%40) ciopts(lcolor(black%40 black%40))) ///
 p35(mcolor(gray%40) msymbol(T) ciopts(lcolor(gray%40 gray%40))) ///
 p36(mcolor(black%40) ciopts(lcolor(black%40 black%40))) ///
 p37(mcolor(gray%40) msymbol(T) ciopts(lcolor(gray%40 gray%40))) ///
 p38(mcolor(black%40) ciopts(lcolor(black%40 black%40))) ///
 p39(mcolor(gray%40) msymbol(T) ciopts(lcolor(gray%40 gray%40))) ///
 p40(mcolor(black%40) ciopts(lcolor(black%40 black%40))) ///
 grid() ytitle("Treatment Effect (April 11 Cutoff)", size(small)) ///
 mlabel(temp) mlabsize(tiny) mlabcolor(gs5) mlabangle(vertical) mlabposition(4) ///
 name(Cutoff5Het, replace)
graph export "Figure3_toppanel.pdf", as(pdf) replace 
 drop temp
 
*Now, we do the same for the May 8 cutoff.*
capture drop temp

*2nd yrs
est clear
local i=0
foreach x in index_NonAcCareer_Index ///
	AppliedResearch Development ManagingSupervising ManagingProjects ProfServices PreSchoolSchool USFedGov USStateGov ForeignGov NonProfit ForProfit SelfEmployed ///
	index_NonAcJobCharac_Index Salary Benefits JobSecurity JobLocation ContribSociety WorklifeBalance ///
	{
	local ++i
	gen t`i' = Cutoff7
	  *2nd years
	  quietly regress `x' t`i' if samp4==1 & fifthyr==0, cl(Day)
      estimates store est`i'
	  drop t`i' 
	  local ++i
	  gen t`i' = Cutoff7
	  *5th years
	  quietly regress `x' t`i' if samp4==1 & fifthyr==1, cl(Day)
      estimates store est`i'
	  drop t`i' 
  }	
  
capture drop temp
gen temp = " " in 1
replace temp =  "{bf: Non-Academic Career Index}" in 2
replace temp =  " " in 3
replace temp =  "Applied Research" in 4
replace temp = " " in 5
replace temp = "Development" in 6
replace temp = " " in 7
replace temp = "Managing/Supervising" in 8
replace temp = " " in 9
replace temp = "Managing Projects" in 10
replace temp = " " in 11
replace temp = "Professional Services" in 12
replace temp = " " in 13
replace temp = "Secondary School or Lower Educ" in 14
replace temp = " '" in 15
replace temp = "U.S. Federal Gov't'" in 16
replace temp = " " in 17
replace temp = "U.S. State/Local Gov't'" in 18
replace temp = " " in 19
replace temp = "Foreign Gov't'" in 20
replace temp = " " in 21
replace temp = "Non-profit" in 22
replace temp = " " in 23
replace temp = "For-profit" in 24
replace temp = " " in 25
replace temp = "Self-employed" in 26

replace temp = " " in 27
replace temp = "{bf: Non-Academic Job Char Index}" in 28
replace temp = " " in 29
replace temp = "Salary" in 30
replace temp = " " in 31
replace temp = "Benefits" in 32
replace temp = " " in 33
replace temp = "Job Security" in 34
replace temp = " " in 35
replace temp = "Job Location" in 36
replace temp = " " in 37
replace temp = "Contribution to Society" in 38
replace temp = " " in 39
replace temp = "Work-life Balance" in 40

coefplot est1 est2 est3 est4 est5 est6 est7 ///
	est8 est9 est10 est11 est12 est13 ///
	est14 est15 est16 ///
	est17 est18 est19 est20 ///
	est21 est22 est23 est24 est25 est26 est27 est28 est29 est30 est31 est32 ///
	est33 est34 est35 est36 est37 est38 est39 est40, level(95 90) ///
keep(t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t13 t14 t15 t16 t17 t18 t19 t20 t21 t22 t23 t24 t25 ///
t26 t27 t28 t29 t30 t31 t32 t33 t34 t35 t36 t37 t38 t39 t40) yline(0, lcolor(gs14) lwidth(thin)) ///
scheme(s1color) aspectratio(0.5) ylab(-.6 "-.6" -.4 "-.4" -.2 ".2" 0 "0" .2 ".2" .4 ".4" .6 ".6") ///
 legend(off) groups(t1 t2 = " " t3 t4 = " " t5 t6 = " " t7 t8 = " " ///
 t9 t10 = " " t11 t12 = " " t13 t14 = " " ///
 t15 t16 = " " t17 t18 = " " t19 t20 = " " t21 t22 = " " t23 t24 = " " t25 t26= " " t27 t28 = " " t29 t30 = " " t31 t32 = " " t33 t34 = " " t35 t36 = " " t37 t38 = " " t39 t40= " ", labsize(tiny)) ///
 vertical  plotregion(lcolor(white)) xscale(range(-0.01 0.05) lcolor(white))  yscale(lcolor(white)) ///
 coeflabel(t1=" " t2=" " t3=" " t4=" " t5=" " t6=" " t7=" " t8=" " t9=" " t10=" " t11=" " t12=" " ///
 t13=" " t14=" " t15=" " t16=" " t17=" " t18=" " t19=" " t20=" " t21=" " t22=" " t23=" " t24=" " t25=" " ///
 t26=" " t27=" " t28=" " t29=" " t30=" " t31=" " t32= " " t33= " " t34= " " t35=" " t36= " " t37= " " t38= " " t39= " " t40= " ", notick) legend(off) ///
 p1(mcolor(gray%100) msymbol(T) ciopts(lcolor(gray%100 gray%100))) ///
 p2(mcolor(black%80) ciopts(lcolor(black%80 black%80))) ///
 p3(mcolor(gray%40) msymbol(T) ciopts(lcolor(gray%40 gray%40))) ///
 p4(mcolor(black%40) ciopts(lcolor(black%40 black%40))) ///
 p5(mcolor(gray%40) msymbol(T) ciopts(lcolor(gray%40 gray%40))) ///
 p6(mcolor(black%40) ciopts(lcolor(black%40 black%40))) ///
 p7(mcolor(gray%40) msymbol(T) ciopts(lcolor(gray%40 gray%40))) ///
 p8(mcolor(black%40) ciopts(lcolor(black%40 black%40))) ///
 p9(mcolor(gray%40) msymbol(T) ciopts(lcolor(gray%40 gray%40))) ///
 p10(mcolor(black%40) ciopts(lcolor(black%40 black%40))) ///
 p11(mcolor(gray%40) msymbol(T) ciopts(lcolor(gray%40 gray%40))) ///
 p12(mcolor(black%40) ciopts(lcolor(black%40 black%40))) ///
 p13(mcolor(gray%40) msymbol(T) ciopts(lcolor(gray%40 gray%40))) ///
 p14(mcolor(black%40) ciopts(lcolor(black%40 black%40))) ///
 p15(mcolor(gray%40) msymbol(T) ciopts(lcolor(gray%40 gray%40))) ///
 p16(mcolor(black%40) ciopts(lcolor(black%40 black%40))) ///
 p17(mcolor(gray%40) msymbol(T) ciopts(lcolor(gray%40 gray%40))) ///
 p18(mcolor(black%40) ciopts(lcolor(black%40 black%40))) ///
 p19(mcolor(gray%40) msymbol(T) ciopts(lcolor(gray%40 gray%40))) ///
 p20(mcolor(black%40) ciopts(lcolor(black%40 black%40))) ///
 p21(mcolor(gray%40) msymbol(T) ciopts(lcolor(gray%40 gray%40))) ///
 p22(mcolor(black%40) ciopts(lcolor(black%40 black%40))) ///
 p23(mcolor(gray%40) msymbol(T) ciopts(lcolor(gray%40 gray%40))) ///
 p24(mcolor(black%40) ciopts(lcolor(black%40 black%40))) ///
 p25(mcolor(gray%40) msymbol(T) ciopts(lcolor(gray%40 gray%40))) ///
 p26(mcolor(black%40) ciopts(lcolor(black%40 black%40))) ///
 p27(mcolor(gray%100) msymbol(T) ciopts(lcolor(gray%100 gray%100))) ///
 p28(mcolor(black%80) ciopts(lcolor(black%80 black%80)))  ///
 p29(mcolor(gray%40) msymbol(T) ciopts(lcolor(gray%40 gray%40))) ///
 p30(mcolor(black%40) ciopts(lcolor(black%40 black%40))) ///
 p31(mcolor(gray%40) msymbol(T) ciopts(lcolor(gray%40 gray%40))) ///
 p32(mcolor(black%40) ciopts(lcolor(black%40 black%40))) ///
 p33(mcolor(gray%40) msymbol(T) ciopts(lcolor(gray%40 gray%40))) ///
 p34(mcolor(black%40) ciopts(lcolor(black%40 black%40))) ///
 p35(mcolor(gray%40) msymbol(T) ciopts(lcolor(gray%40 gray%40))) ///
 p36(mcolor(black%40) ciopts(lcolor(black%40 black%40))) ///
 p37(mcolor(gray%40) msymbol(T) ciopts(lcolor(gray%40 gray%40))) ///
 p38(mcolor(black%40) ciopts(lcolor(black%40 black%40))) ///
 p39(mcolor(gray%40) msymbol(T) ciopts(lcolor(gray%40 gray%40))) ///
 p40(mcolor(black%40) ciopts(lcolor(black%40 black%40))) ///
 grid() ytitle("Treatment Effect (May 8 Cutoff)", size(small)) ///
 mlabel(temp) mlabsize(tiny) mlabcolor(gs5) mlabangle(vertical) mlabposition(4) ///
 name(Cutoff7Het, replace)
graph export "Figure3_bottompanel.pdf", as(pdf) replace 
 drop temp
est clear

********************************************************************************************************************
********************************************************************************************************************
********************************************************************************************************************
*Replication for Results in Supplemental Appendix* 
********************************************************************************************************************
********************************************************************************************************************
********************************************************************************************************************

********************************************************************************************************************
********************************************************************************************************************
*Table F2. Overall Effects by Cutoff Date (Spring 2019)* 
********************************************************************************************************************
********************************************************************************************************************

use Spring2019.dta, clear
global Controls Gender_Bin_Wom USPerm Age BachHigher fifthyr

*The following outputs, for the March 22 cutoff (first four columns) and the March 30 cutoff (second four columns), a separate table for each outcome of interest with results for each of the four different regression specifications.*
foreach var in index_AcCareer_Index index_NonAcCareer_Index index_AcSkills_Index index_NonAcSkills_Index index_AcJobCharac_Index index_NonAcJobCharac_Index Stress_Mgmt Career_Direction Dept_Support Dept_Prep Claim_Fee {
est clear
ren Cutoff1 Cutoff
qui eststo: reg `var' Cutoff if samp4==1, cl(Day)
	estadd scalar n = e(N)
qui eststo: reg `var' Cutoff c.DaysSinceStart  if samp4==1, cl(Day)
	estadd scalar n = e(N)
qui eststo: reg `var' Cutoff c.DaysSinceStart  $Controls  if samp4==1, cl(Day)
	estadd scalar n = e(N)

svyset Day [pweight=Cutoff1_Mean2]
qui eststo: svy: reg `var' Cutoff c.DaysSinceStart 
	estadd scalar n = e(N)

ren Cutoff Cutoff1
ren Cutoff2 Cutoff
	
qui eststo: reg `var' Cutoff if samp4==1, cl(Day)
	estadd scalar n = e(N)
qui eststo: reg `var' Cutoff c.DaysSinceStart  if samp4==1, cl(Day)
	estadd scalar n = e(N)
qui eststo: reg `var' Cutoff c.DaysSinceStart  $Controls  if samp4==1, cl(Day)
	estadd scalar n = e(N)

svyset Day [pweight=Cutoff2_Mean2]
qui eststo: svy: reg `var' Cutoff c.DaysSinceStart 
	estadd scalar n = e(N)

ren Cutoff Cutoff2
	
estout using "TableF2_`var'.tex", replace ///
cells(b(fmt(%9.2f) star) se(par fmt(%9.2f))) style(tex) ///
stats(n, labels("\# Respondents") ///
fmt(%9.0f %9.0f %9.0f)) ///
starlevels(* .10 ** .05 *** .01) ///
keep(Cutoff) /// 
order(Cutoff) /// 
varlabels (Cutoff "Cutoff") ///
mlabels(none) collabels(none)		

}

********************************************************************************************************************
********************************************************************************************************************
*Table F3. Interaction Effects by Cutoff Date (Spring 2019)* 
********************************************************************************************************************
********************************************************************************************************************

*The following outputs, for the March 22 cutoff (first four columns) and the March 30 cutoff (second four columns), a separate table for each outcome of interest with results for each of the four different regression specifications.*
foreach var in index_AcCareer_Index index_NonAcCareer_Index index_AcSkills_Index index_NonAcSkills_Index index_AcJobCharac_Index index_NonAcJobCharac_Index Stress_Mgmt Career_Direction Dept_Support Dept_Prep Claim_Fee {
est clear
ren Cutoff1XXfifth Cutoff
qui eststo: reg `var' i.Cutoff1 i.fifthyr Cutoff if samp4==1, cl(Day)
	estadd scalar n = e(N)
qui eststo: reg `var' i.Cutoff1 i.fifthyr Cutoff c.DaysSinceStart  if samp4==1, cl(Day)
	estadd scalar n = e(N)
qui eststo: reg `var' i.Cutoff1 i.fifthyr Cutoff c.DaysSinceStart  $Controls  if samp4==1, cl(Day)
	estadd scalar n = e(N)

svyset Day [pweight=Cutoff1_Mean2]
qui eststo: svy: reg `var' i.Cutoff1 i.fifthyr Cutoff c.DaysSinceStart 
	estadd scalar n = e(N)

ren Cutoff Cutoff1XXfifth
ren Cutoff2XXfifth Cutoff
	
qui eststo: reg `var' i.Cutoff2 i.fifthyr Cutoff if samp4==1, cl(Day)
	estadd scalar n = e(N)
qui eststo: reg `var' i.Cutoff2 i.fifthyr Cutoff c.DaysSinceStart  if samp4==1, cl(Day)
	estadd scalar n = e(N)
qui eststo: reg `var' i.Cutoff2 i.fifthyr Cutoff c.DaysSinceStart  $Controls  if samp4==1, cl(Day)
	estadd scalar n = e(N)

svyset Day [pweight=Cutoff2_Mean2]
qui eststo: svy: reg `var' i.Cutoff2 i.fifthyr Cutoff c.DaysSinceStart 
	estadd scalar n = e(N)

ren Cutoff Cutoff2XXfifth
	
estout using "TableF3_`var'.tex", replace ///
cells(b(fmt(%9.2f) star) se(par fmt(%9.2f))) style(tex) ///
stats(n, labels("\# Respondents") ///
fmt(%9.0f %9.0f %9.0f)) ///
starlevels(* .10 ** .05 *** .01) ///
keep(Cutoff) /// 
order(Cutoff) /// 
varlabels (Cutoff "Cutoff X Fifthyr") ///
mlabels(none) collabels(none)		

}

********************************************************************************************************************
********************************************************************************************************************
*Table F4. Overall Effects by Alternative Cutoff Date (Spring 2020)* 
********************************************************************************************************************
********************************************************************************************************************

use Main.dta, clear
global Controls Gender_Bin_Wom USPerm Age BachHigher fifthyr

*The following outputs, for the March 22 cutoff (first four columns) and the March 30 cutoff (second four columns), a separate table for each outcome of interest with results for each of the four different regression specifications.*
foreach var in index_AcCareer_Index index_NonAcCareer_Index index_AcSkills_Index index_NonAcSkills_Index index_AcJobCharac_Index index_NonAcJobCharac_Index Stress_Mgmt Career_Direction Dept_Support Dept_Prep Claim_Fee {
est clear
ren Cutoff8 Cutoff
qui eststo: reg `var' Cutoff if samp4==1, cl(Day)
	estadd scalar n = e(N)
qui eststo: reg `var' Cutoff c.DaysSinceStart c.avgUSA_Cases if samp4==1, cl(Day)
	estadd scalar n = e(N)
qui eststo: reg `var' Cutoff c.DaysSinceStart c.avgUSA_Cases $Controls  if samp4==1, cl(Day)
	estadd scalar n = e(N)

svyset Day [pweight=Cutoff8_Mean2]
qui eststo: svy: reg `var' Cutoff c.DaysSinceStart c.avgUSA_Cases
	estadd scalar n = e(N)

ren Cutoff Cutoff8
ren Cutoff9 Cutoff
	
qui eststo: reg `var' Cutoff if samp4==1, cl(Day)
	estadd scalar n = e(N)
qui eststo: reg `var' Cutoff c.DaysSinceStart c.avgUSA_Cases if samp4==1, cl(Day)
	estadd scalar n = e(N)
qui eststo: reg `var' Cutoff c.DaysSinceStart c.avgUSA_Cases $Controls  if samp4==1, cl(Day)
	estadd scalar n = e(N)

svyset Day [pweight=Cutoff9_Mean2]
qui eststo: svy: reg `var' Cutoff c.DaysSinceStart c.avgUSA_Cases
	estadd scalar n = e(N)

ren Cutoff Cutoff9
	
estout using "TableF4_`var'.tex", replace ///
cells(b(fmt(%9.2f) star) se(par fmt(%9.2f))) style(tex) ///
stats(n, labels("\# Respondents") ///
fmt(%9.0f %9.0f %9.0f)) ///
starlevels(* .10 ** .05 *** .01) ///
keep(Cutoff) /// 
order(Cutoff) /// 
varlabels (Cutoff "Cutoff") ///
mlabels(none) collabels(none)		

}

********************************************************************************************************************
********************************************************************************************************************
*Table F5. Interaction Effects by Alternative Cutoff Date (Spring 2020)* 
********************************************************************************************************************
********************************************************************************************************************

*The following outputs, for the March 22 cutoff (first four columns) and the March 30 cutoff (second four columns), a separate table for each outcome of interest with results for each of the four different regression specifications.*
foreach var in index_AcCareer_Index index_NonAcCareer_Index index_AcSkills_Index index_NonAcSkills_Index index_AcJobCharac_Index index_NonAcJobCharac_Index Stress_Mgmt Career_Direction Dept_Support Dept_Prep Claim_Fee {
est clear
ren Cutoff8XXfifth Cutoff
qui eststo: reg `var' i.Cutoff8 i.fifthyr Cutoff if samp4==1, cl(Day)
	estadd scalar n = e(N)
qui eststo: reg `var' i.Cutoff8 i.fifthyr Cutoff c.DaysSinceStart c.avgUSA_Cases if samp4==1, cl(Day)
	estadd scalar n = e(N)
qui eststo: reg `var' i.Cutoff8 i.fifthyr Cutoff c.DaysSinceStart c.avgUSA_Cases $Controls  if samp4==1, cl(Day)
	estadd scalar n = e(N)

svyset Day [pweight=Cutoff8_Mean2]
qui eststo: svy: reg `var' i.Cutoff8 i.fifthyr Cutoff c.DaysSinceStart c.avgUSA_Cases
	estadd scalar n = e(N)

ren Cutoff Cutoff8XXfifth
ren Cutoff9XXfifth Cutoff
	
qui eststo: reg `var' i.Cutoff9 i.fifthyr Cutoff if samp4==1, cl(Day)
	estadd scalar n = e(N)
qui eststo: reg `var' i.Cutoff9 i.fifthyr Cutoff c.DaysSinceStart c.avgUSA_Cases if samp4==1, cl(Day)
	estadd scalar n = e(N)
qui eststo: reg `var' i.Cutoff9 i.fifthyr Cutoff c.DaysSinceStart c.avgUSA_Cases $Controls  if samp4==1, cl(Day)
	estadd scalar n = e(N)

svyset Day [pweight=Cutoff9_Mean2]
qui eststo: svy: reg `var' i.Cutoff9 i.fifthyr Cutoff c.DaysSinceStart c.avgUSA_Cases
	estadd scalar n = e(N)

ren Cutoff Cutoff9XXfifth
	
estout using "TableF5_`var'.tex", replace ///
cells(b(fmt(%9.2f) star) se(par fmt(%9.2f))) style(tex) ///
stats(n, labels("\# Respondents") ///
fmt(%9.0f %9.0f %9.0f)) ///
starlevels(* .10 ** .05 *** .01) ///
keep(Cutoff) /// 
order(Cutoff) /// 
varlabels (Cutoff "Cutoff X Fifthyr") ///
mlabels(none) collabels(none)		
}


********************************************************************************************************************
********************************************************************************************************************
*Table F6. Balance on Demographics (Spring 2019)* 
********************************************************************************************************************
********************************************************************************************************************

use Spring2019.dta, clear

*To see pre- and post-cutoff sample sizes, by cutoff:
foreach var in Cutoff1 Cutoff2 {
tab `var'
}

*Generate balance table, including results separately for each of the specified cutoffs (March 22 and 30).*

preserve

*Multiply percentages by 100.*
foreach var in Gender_Bin_Wom USPerm Hispanic Ethnicity5 BachHigher fifthyr {
ren `var' `var'_n
gen `var'=100*(`var'_n)	
}

label var Gender_Bin_Wom "Women (\%)"
label var USPerm "U.S. Citizen/Perm Res (\%)"
label var Hispanic "Hispanic (\%)" 
label var Age "Age (average)" 
label var BachHigher "Parent: Bach Deg/Higher (\%)" 
label var fifthyr "5th Year PhD (vs. 2nd, (\%))" 
lab var Ethnicity5 "White (\%)"

balancetable Cutoff1 Gender_Bin_Wom USPerm Hispanic Ethnicity5 Age BachHigher fifthyr using "TableF6.tex", observationscolumn pval varlabels  ctitles("Before Cutoff" "After Cutoff" "Difference (Before-After)" "N") format(%9.2f) nofoot leftctitle(" ") oneline replace

balancetable Cutoff2 Gender_Bin_Wom USPerm Hispanic Ethnicity5 Age BachHigher fifthyr using "TableF6.tex", nonumbers observationscolumn pval varlabels format(%9.2f) nohead nofoot noobservations oneline  append

restore









